<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="com.scalar.forecast.commons.Constants" %>
<%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld"  prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-nested.tld"  prefix="nested"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean"%>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<SCRIPT language=JavaScript src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</SCRIPT>
<SCRIPT language=JavaScript src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</SCRIPT>
<SCRIPT>
    function submitPage(actionvalue)
    {
        var form = document.salesForecastEntryForm;
        var pa   = document.getElementById ( 'errorsId' );
        errors    = "";
        var startMonthCtrl  = form.month;
        var yearCtrl        = form.year
        var showNextCtrl    = form.showNext;
        if ( startMonthCtrl.value == -1 )
        {
            errors    = errors + "<li>Please select Start Month</li>"
        }
        if ( yearCtrl.value == -1 )
        {
            errors    = errors + "<li>Please select Year</li>"
        }
        if ( trim ( showNextCtrl.value ) == '' )
        {
            errors = errors + "<li>Please enter value for Show Next</li>"
        }
        if( !isInteger( showNextCtrl.value ) )
        {
            errors = errors +"<li>Please enter a valid Number for Show Next";
        }
        else if ( parseInt ( showNextCtrl.value, 10 ) <= 0 )
        {
            errors = errors +"<li>Please enter a valid Number for Show Next";
        }
        if ( errors != "" )
        {
            pa.innerHTML    = errors;
        }
        else
        {
            form.action = "salesForecastEntry.do?action="+actionvalue;
            form.submit();
        }
    }
    function uploadFileView()
    {
        newWindow = window.open('<%=chipTracContext%>/salesForecastEntry.do?action=<%=Constants.ACTION_UPLOAD_VIEW%>','uploadPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=no,width=600,height=400,left=300,top=40');
  	    newWindow.focus();
    }
</SCRIPT>
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<!-- Top Header Start-->
    <%
        String userTypeChiptrac = com.scalar.chiptrack.commons.Constants.USER_TYPE_CHIPTRAC + "";
    %>
    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/header.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/extHeader.jsp" %>
    </logic:notEqual>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0><!--TBODY-->
  <TBODY>
  <TR>
    <TD vAlign=top width=180 background="<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif">
  <!-- Side Navigation start -->
    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/marketing/marketing_menu.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/forecast/external_forecast_menu.jsp" %>
    </logic:notEqual>
 <!-- end of the side navigations -->
    <TD bgColor=#ffffff><IMG height=9
      src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
    <TD bgColor=#ffffff><IMG height=480
      src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=10></TD>
    <TD vAlign=top width="100%"><IMG height=1
      src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0> <BR>
<!-- from here your body starts -->
<html:form action="/salesForecastEntry" name="salesForecastEntryForm" type="com.scalar.forecast.salesForecastEntry.forms.SalesForecastEntryForm">
      <TABLE width="100%" align=center border=0>
        <TBODY>
        <TR>
          <TD class=NArialW align=middle colSpan=5>Sales Forecast</TD></TR>
        <TR>
          <TD colSpan=5>&nbsp;</TD></TR>
        <TR><TD colspan='5' id='errorMessagesId'>
                <chiptrack:info styleClass='NArialL' />
                <chiptrack:errors styleClass='NArialL' />
        </TD></TR>
        <TR><TD colspan='5' class="NArialL"><FONT id="errorsId"  color='FF0000'></FONT></TD></TR>

        <TR>
            <TD colSpan=3 align="right" class="NArialL">
                <chiptrack:restrictedLink functionality='<%=Functionality.SALES_FORECAST_UPLOAD_FILE%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage('download');" onmouseover="window.status='Click here to upload Sales Forecast';return true" onmouseout="window.status='';return true">
                    Click here to Download File
                </chiptrack:restrictedLink>&nbsp;&nbsp;&nbsp;&nbsp;
            </TD>
            <TD  class="NArialL">&nbsp;</td>
        </TR>
        <TR>
            <TD colSpan=3 align="right" class="NArialL">
                <chiptrack:restrictedLink functionality='<%=Functionality.SALES_FORECAST_UPLOAD_FILE%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:uploadFileView();" onmouseover="window.status='Click here to upload Sales Forecast';return true" onmouseout="window.status='';return true">
                    Click here to Upload File
                </chiptrack:restrictedLink>&nbsp;&nbsp;&nbsp;&nbsp;
            </TD>
            <TD  class="NArialL">&nbsp;</td>
        </TR>
        <TR>
          <TD>
            <TABLE width="80%" align="center">
              <TBODY>
			  	<TR>
                        <TD nowrap><FONT class=NArialL>Start Month :</FONT></TD>
                        <TD class=NArialL nowrap>
                            <nested:select property="month" styleClass="txfield">
                                <option value="-1">---select---</option>
                                <nested:options collection="monthsList" property="value" labelProperty="label"/>
                            </nested:select>
                       </TD>
					    <TD width="5%">&nbsp;</TD>
                        <TD class=NArialL >Year :</TD>
                        <TD class=NArialL nowrap>
                        	<nested:select property="year" styleClass="txfield">
                                <option value="-1">---select---</option>
                                <nested:options collection="yearsList" property="value" labelProperty="label"/>
                            </nested:select>
                       </TD>
			   </TR>
			   <TR>
               <TD bgColor=#ffffff><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD></TR>
              <TR>
                  <TR>
                        <TD><FONT class=NArialL>Show Next :</FONT></TD>
                        <TD class=NArialL>
                            <nested:text property="showNext" size="4" styleClass="txfield" onkeypress="javascript:allowInteger()" maxlength='2'/> Months
                       </TD>
					   <TD width="5%">&nbsp;</TD>
                        <TD class=NArialL >Sales Person :</TD>
                        <TD class=NArialL >
                            <nested:select property="spersonId" styleClass="txfield">
                                <nested:options collection="sPersonList" property="value" labelProperty="label"/>
                            </nested:select>
                        </TD>
			   </TR>
              <TR>
               <TD bgColor=#ffffff><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD></TR>
              <TR>
                <TD width="100%" colSpan=5 align="center">
                    <A href="javascript:submitPage('new');"><IMG
					onmouseover="window.status='Click to Submit';return true"
					title="Click to Submit"
					onmouseout="window.status='';return true" height=17
					src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width=53
					border=0></A>&nbsp;&nbsp;&nbsp;&nbsp;
                  <A href="javascript:document.salesForecastEntryForm.reset();"><IMG
					onmouseover="window.status='Click to Reset';return true"
					title="Click here to Reset"
					onmouseout="window.status='';return true"
					src="<%=chipTracContext%>/jsp/includes/images/reset.gif"
					border=0 width="53" height="17"></A>
                </TD>
                </TR>
            </TBODY></TABLE></TD></TR>
</html:form>

        <TR>
          <TD><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"
width=10></TD></TR>


		 </TBODY></TABLE></TD>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>